package com.rlyy.rsj.job.remind;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.rlyy.rsj.common.RemindType;
import com.rlyy.rsj.entity.ReceiveUser;
import com.rlyy.rsj.entity.RemindEntity;
import com.rlyy.rsj.entity.RemindTable;
import com.rlyy.rsj.entity.UsageRemindEntity;
import common.util.emailUtils.TemplateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

public interface IRemind {

    Logger logger = LoggerFactory.getLogger(IRemind.class);

    boolean remindCondition(RemindEntity remindEntity, RemindTable remindInfo);

    void doRemind(RemindEntity remindEntity, ReceiveUser receiveUser);

    RemindType getRemindType();

    default String parseMailContent(Object entity, String mailTemplate){
        Map<String, Object> params = JSONObject.parseObject(JSONObject.toJSONString(entity, SerializerFeature.WriteNullStringAsEmpty), Map.class);
        return TemplateUtils.doParseMailTemplate(mailTemplate, params);
    }
}
